<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{$SEO['title']}}</title>
    <meta name="keywords" content="{{$SEO['keywords']}}"/>
    <meta name="description" content="{{$SEO['description']}}"/>
    <!--公用css引用-->
    @include('front.common.style')
            <!--END/公用css引用-->
    <link rel="stylesheet" href="../dist/css/index.css">
</head>
<body>
<!--公共头部-->
@include('front.common.header')

<!--END/公共头部-->
@inject('pictureService','App\Interfaces\PictureService')
@inject('adService','App\Interfaces\AdService')
@inject('cartService','App\Interfaces\CartService')

<?php
$cartGoods = $cartService->getInfo();
$total_number = $cartService->getCartNumber();
?>
<!--banner图-->
<div class="banner fn-rel">
    <ul id="js-banner" class="rslides">

        @if(count($adService->get('index_focus')))
        @foreach($adService->get('index_focus') as $ad)
        <li><a class="fn-clear img" href="{{$ad->url}}" target="_blank" style="background: url('{{$pictureService::thumb($ad->image)}}') no-repeat center;"></a></li>
        @endforeach
            @endif


    </ul>
    <div class="inbox rslides-nav"></div>
</div>
<!--END/banner图-->

<!--专场直达-->

<div class="inbox">
    <div class="panel-head tit-1 fn-mt30">
        <h1 class="h"><i class="icon icon-01"></i>专场直达</h1>
    </div>
    @inject('activityService','App\Interfaces\ActivityService')

  
    <div class="panel-body">
        <ul class="imglist-2col- bl-imglist imglist-1 no-space">
            @foreach ($activityService->getRecommendActivity() as $k=>$activity )
                <li>
                    <a class="opacity-img" href="/activity/{{$activity->identification}}" target="_blank" title="{{$activity->name}}">
                        <img class="lazy img-lazyload" data-src="{{$pictureService::thumb($activity->activity_thumb,520,240)}}" alt="{{$activity->name}}">
                    </a>
                    <div class="con fn-hide">
                        <a href="/activity/{{$activity->id}}" target="_blank" class="head text-color-2 strong" title="{{$activity->name}}">{{$activity->name}}</a>
                        <p class="des text-color-2" title="{{$activity->description}}">{{$activity->description}}</p>
                        <a href="/activity/{{$activity->identification}}" target="_blank" class="fn-btn btn-noBg-1">立即抢购</a>
                    </div>
                </li>
            @endforeach

        </ul>
    </div>
</div>
<!--END/专场直达-->

<!--热卖爆品-->
@inject('recommendPositionService','App\Interfaces\RecommendPositionService')
@inject('goodsService','App\Interfaces\GoodsService')
@inject('brandService','App\Interfaces\BrandService')
<?php 
$identification = "index_baopin";
//获取推荐位置
$recommendposition = $recommendPositionService->getRecommendPosition($identification);
if($recommendposition){

?>


<div class="inbox">
    <div class="panel-head tit-1 fn-mt30">
        <h1 class="h"><i class="icon icon-02"></i>{{$recommendposition->name}}</h1>
    </div>
    <div class="panel-body">
        <ul class="imglist-2">
        <?php //dd($recommendPositionService->getRecommendGoods($identification));?>
            @foreach ($recommendPositionService->getRecommendGoods($identification) as $k=>$recommend )
            @if($recommend->is_on_sale == 1)
            <?php
                //获取商品信息

                $goods = $goodsService->get($recommend->link);
                if($goods){
                //获取品牌ID
                $brand_id = $goods->brand_id;
                //获取品牌信息
                $brand = $brandService->get($brand_id);
            ?>

            <li class="ui-cols-2">
                <div class="col col-l opacity-img">
                    <a href="/goods/{{$recommend->link}}" target="_blank" title="{{$recommend->title}}">
                        <img class="lazy img-lazyload" data-src="{{$pictureService::thumb($recommend->picture,525,330)}}" alt="{{$recommend->title}}">
                    </a>
                </div>
                <div class="col col-r">
                    <div class="panel-head">
                        <img class="fn-fl lazy img-lazyload" data-src="{{$pictureService::thumb($brand->brand_logo,56,38)}}" alt="{{$brand->brand_name}}" title="{{$brand->brand_name}}">
                        <span class="small">{{$brand->brand_name}}<br>{{$recommend->resource}}</span>
                    </div>
                    <div class="panel-body">
                        <a href="/goods/{{$recommend->link}}" target="_blank" class="tit fn-dib-otw ui-100" title="{{$recommend->title}}">{{$recommend->title}}</a>
                        <p class="sub-tit fn-dib-otw" title="{{$recommend->subtitle}}">{{$recommend->subtitle}}</p>
                        <p class="des" title="{{$recommend->description}}">{{$recommend->description}}</p>
                        <p class="text-color-1">售价<span class="font-24">￥</span><span class="f-size-L font-30">{{$recommend->shop_price}}</span></p>
                        <p>国内参考价￥<span class="font-20">{{$recommend->market_price}}</span></p>
                        <a href="javascript:;" data-id="{{$recommend->link}}" class="J-add-cart buy-link" title="加入购物车"><i class="icon icon-06"></i></a>
                    </div>
                </div>
            </li>
           <?php } ?>
           @endif
            @endforeach
 
        </ul>
    </div>
</div>
<?php } ?>
<!--END/热卖爆品-->

<!--全球精选-->
<?php
$identification = "index_jingxuan";
$recommendposition = $recommendPositionService->getRecommendPosition($identification);
if($recommendposition){
 ?>
<div class="inbox">
    <div class="panel-head tit-1 fn-mt30">
        <h1 class="h"><i class="icon icon-03"></i>{{$recommendposition->name}}</h1>
    </div>
    <div class="panel-body">
        <ul class="imglist-2 ui-cols-2 imglist-2-ver imglist-skin-3">
        @foreach ($recommendPositionService->getRecommendGoods($identification) as $k=>$recommend )
        @if($recommend->is_on_sale == 1)
        <?php
                //获取商品信息
                $goods = $goodsService->get($recommend->link);
                if($goods){
                //获取品牌ID
                $brand_id = $goods->brand_id;
                //获取品牌信息 col col-space left-space
                $brand = $brandService->get($brand_id);
        ?>          
            <li class="@if($k%2==0) col col-space @else col col-space left-space @endif">
                <div class="col-box">
                    <div class="col-l opacity-img">
                        <a href="/goods/{{$recommend->link}}" target="_blank" title="{{$recommend->title}}">
                            <img class="lazy img-lazyload"  data-src="{{$pictureService::thumb($recommend->picture,518,330)}}" alt="{{$recommend->title}}">
                        </a>
                    </div>
                    <div class="col-r">
                        <div class="panel-head">
                            <img class="fn-fl lazy img-lazyload"  data-src="{{$pictureService::thumb($brand->brand_logo,28,20)}}" alt="{{$brand->brand_name}}">
                            <span class="small">{{$brand->brand_name}} {{$recommend->resource}}</span>
                        </div>
                        <div class="panel-body">
                            <h1><a class="tit link fn-dib-otw ui-100" href="/goods/{{$recommend->link}}" target="_blank" title="{{$recommend->title}}">{{$recommend->title}}</a></h1>
                            <p class="sub-tit fn-dib-otw">{{$recommend->subtitle}}</p>
                            <p>
                                <span class="text-color-1 fn-mr6">售价<span class="font-24">￥</span><span class="f-size-L font-30">{{$goods->shop_price}}</span></span>
                                国内参考价￥<span class="font-20">{{$recommend->market_price}}</span>
                            </p>
                            <a href="javascript:;" data-id="{{$recommend->link}}" class="J-add-cart buy-link" title="加入购物车"><i class="icon icon-06"></i></a>
                        </div>
                    </div>
                </div>
            </li>
            <?php } ?>
            @endif
            @endforeach             
        </ul>
    </div>
</div>
<?php } ?>
<!--END/全球精选-->

<!--美妆个护-->
@inject('categoryService','App\Interfaces\CategoryService')
@foreach($categoryService->top() as $k=>$cat )
<?php
//获取分类名称作为推荐标识
$identification = "index_recommend_cat_".$cat->cat_id;
//dd($identification);
$recommendposition = $recommendPositionService->getRecommendPosition($identification);
if($recommendposition){
 ?>
<div id="section-{{$cat->cat_id}}" class="inbox bl-tab tab-skin-ellipse">
    <div class="panel-head tit-1 fn-mt30">

        <?php
         $d = 0;
         $bar_icon_id=0;
         //dd($type_icon_id); 
         $cat_order = $cat->sort_order;
         //图片对应:d=3:美妆个护;d=5:进口食品;d=4:母婴用品;d=6:服饰鞋包;d=7:营养保健;d=9:居家生活;d=8:平行进口车;
         switch($cat_order)
            {
            case "7":$d=3;
            break;
            case "6":$d=5;
            break;
            case "5":$d=4;
            break;
            case "4":$d=6;
            break;
            case "3":$d=7;
            break;
            case "2":$d=9;
            break;
            case "1":$d=8;
            break;
            default:$d = 0;
            }
         ?>
    
        <h1 class="h"><i class="icon type-icon type-icon-{{$d}} fn-mr4"></i>{{$cat->cat_name}}</h1>
               
        <ul class="more tab-head">

            <li class="tab"><a href="/cat/{{$cat->cat_id}}" target="_blank">热门</a><span class="borr"></span></li>
            @foreach($cat->getChildren($cat->cat_id) as $c=>$child)
            <li class="tab"><a href="/cat/{{$child->cat_id}}" target="_blank">{{$child->cat_name}}</a><span class="borr"></span></li>
            @endforeach
            <li class="tab"><a href="/cat/{{$cat->cat_id}}" target="_blank">更多</a><span class="borr"></span></li>
        </ul>
    </div>
    <?php 
    $recommend = $recommendPositionService->getRecommendGoods($identification)->toArray();
//dd($recommend);
    $count = count($recommend);

    $first = $recommendPositionService->getRecommendGoods($identification)->first();
//dd($recommend);
    ?>
     
    <div class="panel-body border tab-con">
        <div class="tab-show" style="display:block;">
            <ul class="imglist-2col bl-imglist imglist-3">

               @if($first)

                <li>
                    <a class="opacity-img" target="_blank" title="{{$recommend[0]['title']}}" href="/goods/{{$recommend[0]['link']}}">
                        <img class="lazy img-lazyload" data-src="{{$pictureService::thumb($recommend[0]['picture'],525,370)}}" alt="{{$recommend[0]['title']}}">
                    </a>
                    <span class="borr"></span>
                    @if($count>3)
                    <span class="borb"></span>
                    @endif
                </li>
                @endif
    
                <li>
                    <ul class="imglist-2col bl-imglist imglist-4">
                        @if($count>1)


                        <li @if($k==1) class="bg-2" @else class="" @endif>
                            <a class="link-mark opacity-img" title="{{$recommend[1]['title']}}" href="/goods/{{$recommend[1]['link']}}" target="_blank">

                                <img class="pos-bl lazy img-lazyload" data-src="{{$pictureService::thumb($recommend[1]['picture'],262,370)}}" alt="{{$recommend[1]['title']}}">
                            </a>
                            <span class="borr"></span>
                            @if($count>3)
                                <span class="borb"></span>
                            @endif
                        </li>
                        @endif
                        @if($count>2)


                        <li @if($k==1) class="bg-2" @else class="" @endif>
                            <a class="link-mark opacity-img" title="{{$recommend[2]['title']}}" href="/goods/{{$recommend[2]['link']}}" target="_blank">

                                <img class="pos-bl lazy img-lazyload" data-src="{{$pictureService::thumb($recommend[2]['picture'],262,370)}}" alt="{{$recommend[2]['title']}}">
                            </a>
                            @if($count>3)
                                <span class="borb"></span>
                            @endif
                        </li>
                        @endif
                    </ul>
                </li>
            </ul>
            <ul class="imglist-4col bl-imglist imglist-5">
                @for($k=3;$k<$count;$k++)
                <li class="opacity-img">

                    <a class="link-mark" href="/goods/{{$recommend[$k]['link']}}" target="_blank" title="{{$recommend[$k]['title']}}">
                        <img class="lazy img-lazyload" data-src="{{$pictureService::thumb($recommend[$k]['picture'],262,160)}}" alt="{{$recommend[$k]['title']}}">
                    </a>

                    @if(($k-2)%4!=0)
                    <span class="borr"></span>
                    @endif
                    @if($count>7&&$k<$count-(($count-3)%4==0?4:($count-3)%4))
                    <span class="borb"></span>
                    @endif
                </li>
                @endfor

            </ul>

        </div>
        </div>
      
    </div>

</div>
<?php } ?>
@endforeach

<!--END/美妆个护-->






<!--右侧浮动导航-->
<div id="rightBar" class="right-bar">
    <ul>
        <li class="placeholder-li"></li>
        @foreach($categoryService->top() as $k=>$cat )
        <?php
         $s = 0;
         $cat_order = $cat->sort_order;
         //图片对应:s=1:美妆个护;s=2:进口食品;s=3:母婴用品;s=4:服饰鞋包;s=10:营养保健;s=11:居家生活;s=12:平行进口车;
         switch($cat_order)
            {
            case "7":$s=1;
            break;
            case "6":$s=2;
            break;
            case "5":$s=3;
            break;
            case "4":$s=4;
            break;
            case "3":$s=10;
            break;
            case "2":$s=11;
            break;
            case "1":$s=12;
            break;
            default:$s = 0;
            }

         ?>
        <li>
            <a class="js-floor" href="#section-{{$cat->cat_id}}">
                <i class="icon icon-bar-{{$s}}"></i>
                <p class="text">{{$cat->cat_name}}</p>
                <span class="borb"></span>
            </a>
        </li>
        @endforeach
        <li id="js-cart" class="js-cart reset-skin cart">
            <a target="_blank" href="/cart">
                <i class="icon icon-bar-6"></i>
                <p class="text">购物车</p>
                <i class="icon icon-bar-9 cart-num">{{$total_number}}</i>
                <span class="borb"></span>
            </a>
        </li>
        <li class="reset-skin online-service hover-show-tip fn-rel">
            <a href="http://wpa.qq.com/msgrd?v=3&uin=3039215126&site=qq&menu=yes" target="_blank" title="在线客服">
                <i class="icon icon-qq-red"></i>
                <span class="borb"></span>
            </a>

            <div class="bl-tip-box tip-skin-gray" style="left: -120px;top:-42px;width:110px; ">
                <div class="mask-R"></div>
                <div class="J-box RJ-box"><span class="J"></span><i class="J"></i></div>
                <div class="bl-tip-con">
                    <ul>
                        <li>
                            <a class="js-qq" data-qq="3039215126" href="http://wpa.qq.com/msgrd?v=3&amp;uin=3039215126&amp;site=qq&amp;menu=yes" target="_blank" title="离线"><i class="icon icon-qq-gray-sm fn-mr4" style="margin-top: -3px;"></i>客服-小阿</a>
                        </li>
                        <li>
                            <a class="js-qq" data-qq="1378461406" href="http://wpa.qq.com/msgrd?v=3&amp;uin=1378461406&amp;site=qq&amp;menu=yes" target="_blank" title="离线"><i class="icon icon-qq-gray-sm fn-mr4" style="margin-top: -3px;"></i>客服-小福</a>
                        </li>
                        <li>
                            <a class="js-qq" data-qq="2151543159" href="http://wpa.qq.com/msgrd?v=3&amp;uin=2151543159&amp;site=qq&amp;menu=yes" target="_blank" title="离线"><i class="icon icon-qq-gray-sm fn-mr4" style="margin-top: -3px;"></i>客服-小易</a>
                        </li>
                        <li>
                            <a class="js-qq" data-qq="3082657948" href="http://wpa.qq.com/msgrd?v=3&amp;uin=3082657948&amp;site=qq&amp;menu=yes" target="_blank" title="离线"><i class="icon icon-qq-gray-sm fn-mr4" style="margin-top: -3px;"></i>客服-小塔</a>
                        </li>
                    </ul>
                </div>
            </div>
        </li>
        <li class="reset-skin go-top">
            <a class="js-goTop" href="#" title="返回顶部">
                <i class="icon icon-bar-8"></i>
            </a>
        </li>
    </ul>
</div>
<!--END/右侧浮动导航-->



<!--公共尾部-->
@include('front.common.footer')
        <!--END/公共尾部-->


<!--公用js引用-->
@include('front.common.script')
        <!--END/公用js引用-->

<script src="../dist/js/responsiveslides.min.js"></script>
<script src="/layer/layer.js"></script>
<script src="../dist/js/scroll.js"></script>
<script src="../dist/js/home.js"></script>
<script type="text/javascript">
    var qqNum="";
    $(".js-qq").each(function(index,e){
        var qq=$(e).data("qq");
        qqNum+=qq+":";
    });
    //动态创建javascript跨域获取QQ在线状态
    var online = [];
    var url="http://webpresence.qq.com/getonline?Type=1&"+qqNum;
    $.getScript(url)
    .done(function() {
        //scrpit加载完成后执行在线状态图片的改写


        $(".js-qq").each(function(index,e){
             if(online[index]=="1"){
                 $(e).find(".icon").addClass('icon-qq-blue-sm').removeClass('icon-qq-gray-sm');
                 $(e).attr('title','在线');
             }
         });
    });

    var index = parent.layer.getFrameIndex(window.name);
    @if(\Illuminate\Support\Facades\Auth::check())
    parent.$("#login").val(1);
    parent.layer.close(index);
        @endif

</script>
</body>
</html>